#include <func.h>

int getFileName(char *fileName, const char *curPath);
int main(){
    // /lsx/file
    char buf[] = "/lsx/file";
    char fileName[100] = {0};
    getFileName(fileName, buf);
    puts(fileName);
}

int getFileName(char *fileName, const char *curPath){
    int lastSlash = 0;
    for(int i = strlen(curPath) - 1; i != 0; i--){
        if(curPath[i] != '/')
            lastSlash++;
        else
            break;
    }
    strncpy(fileName, curPath + (strlen(curPath) - lastSlash), lastSlash);
    return 0;
}